Öscillofun

Showcase your libraries, tools and other projects that help your fellow love users.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Öscillofun

Post by thelinx »

The amount of samples in a song basically defines how good the quality of the audio is. Usually, the sample rate is 44100 for regular CDs, meaning 44100 numbers between -1 and 1 per channel and second.

To visualise this song, I deduce a pixel position by taking a sample from the left channel as the X position and a sample from the right channel as the Y position.
Since the coordinates are (-1 < x < 1, -1 < y < 1), I need to decide where to put each point in the full window.

The finished position looks something like this: (getWidth() / 2 + getWidth() * x, getHeight() / 2 + getHeight() * y).
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Öscillofun

Post by BlackBulletIV »

But how do you get multiple pixels on the screen at the same time? How do you know how many samples to draw per frame?

EDIT: Oh, you probably use dt to decide the number of samples.
User avatar
thelinx
The Strongest
Posts: 857
Joined: Fri Sep 26, 2008 3:56 pm
Location: Sweden

Re: Öscillofun

Post by thelinx »

It's open source ;)
User avatar
BlackBulletIV
Inner party member
Posts: 1261
Joined: Wed Dec 29, 2010 8:19 pm
Location: Queensland, Australia
Contact:

Re: Öscillofun

Post by BlackBulletIV »

Of course. ;)
DarkShroom
Citizen
Posts: 86
Joined: Mon Jul 17, 2017 2:07 pm

Re: Öscillofun

Post by DarkShroom »

thread ressurection warning

seriously i would really love to make a visualizer, how do you get this data into Love 2D?
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Öscillofun

Post by zorg »

DarkShroom wrote: Wed Jun 20, 2018 12:11 am thread ressurection warning

seriously i would really love to make a visualizer, how do you get this data into Love 2D?
0. Stop resurrecting dead threads, and open a new one :P
1. Create SoundData (Either empty or from a music file)
There, now the data is there, and you can access it with :getSample().
As for how to actually visualize things, that's up for the reader to figure out :P (There are tons of methods, even for just a plain and simple oscilloscope)
But let me post an image of one of the many projects i made in löve, albeit not yet released, to illustrate what's possible.
fft_stuff.png
fft_stuff.png (858.6 KiB) Viewed 11128 times
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
User avatar
pgimeno
Party member
Posts: 3672
Joined: Sun Oct 18, 2015 2:58 pm

Re: Öscillofun

Post by pgimeno »

Nice looking :)

That looks like a spectrogram! IMO spectrograms look sooo much nicer when the magnitude at each pixel is represented by a palette colour, preferably ranging from black through cold then warm colours, peaking at bright yellow or white e.g. https://www.youtube.com/watch?v=yzFit0nldf4
User avatar
zorg
Party member
Posts: 3468
Joined: Thu Dec 13, 2012 2:55 pm
Location: Absurdistan, Hungary
Contact:

Re: Öscillofun

Post by zorg »

pgimeno wrote: Wed Jun 20, 2018 9:08 am Nice looking :)

That looks like a spectrogram! IMO spectrograms look sooo much nicer when the magnitude at each pixel is represented by a palette colour, preferably ranging from black through cold then warm colours, peaking at bright yellow or white e.g. https://www.youtube.com/watch?v=yzFit0nldf4
Agreed, it would make more sense, but since i was coloring the sine-decomposition circles in the background, i didn't want the spectrogram to be too distracting... the upside is i know the perfect combination of blendmodes to clear one line every time, the downside is that it can only show 256 separate values since monochrome.
Me and my stuff :3True Neutral Aspirant. Why, yes, i do indeed enjoy sarcastically correcting others when they make the most blatant of spelling mistakes. No bullying or trolling the innocent tho.
logo4poop
Prole
Posts: 1
Joined: Sun Nov 03, 2019 2:03 pm

Re: Öscillofun

Post by logo4poop »

Can you reupload this?
alejandroalzate
Citizen
Posts: 67
Joined: Sat May 08, 2021 9:45 pm

Re: Öscillofun

Post by alejandroalzate »

anyone with a copy? i got a 404 for pretty much everything :(

Code: Select all

target = boardIndex.getWhosPeekingThisLine()
target:setObey(true)
Post Reply

Who is online

Users browsing this forum: No registered users and 2 guests