Page 3 of 3

Re: Öscillofun

Posted: Mon Apr 18, 2011 2:19 pm
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).

Re: Öscillofun

Posted: Mon Apr 18, 2011 8:57 pm
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.

Re: Öscillofun

Posted: Tue Apr 19, 2011 7:15 pm
by thelinx
It's open source ;)

Re: Öscillofun

Posted: Tue Apr 19, 2011 8:15 pm
by BlackBulletIV
Of course. ;)

Re: Öscillofun

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

seriously i would really love to make a visualizer, how do you get this data into Love 2D?

Re: Öscillofun

Posted: Wed Jun 20, 2018 7:34 am
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 11133 times

Re: Öscillofun

Posted: Wed Jun 20, 2018 9:08 am
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

Re: Öscillofun

Posted: Thu Jun 21, 2018 4:25 am
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.

Re: Öscillofun

Posted: Sun Nov 03, 2019 2:06 pm
by logo4poop
Can you reupload this?

Re: Öscillofun

Posted: Sat Dec 23, 2023 8:54 pm
by alejandroalzate
anyone with a copy? i got a 404 for pretty much everything :(