AudioWaveform

Visuals, audio, animation. Blended, not stirred. If LiveCode is part of your rich media production toolbox, this is the forum for you.

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

Post Reply
bernd59
Posts: 10
Joined: Sat Nov 11, 2017 12:21 pm

AudioWaveform

Post by bernd59 » Sun Feb 25, 2018 4:14 pm

Dear all
I want to access sample values of a audio file (uncompressed: wav)
I got a rev-code for that from a friend: AudioWaveform.rev
But I can not load a wav file in that .rev stack using LiveCode 9
Does anyone know a newer version of AudioWaveform ?

Or a more general question: I found -> customProperties["FileInfo"]
which allows me to read the file header.
Does anyone know how to access the same-values of a wav-file in order to display an oscillogram?

Best
Bernd

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1785
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: AudioWaveform

Post by [-hh] » Tue Feb 27, 2018 5:27 pm

There are *mighty* cross-platform tools available that can (also) create waveforms.

1. CLIs, you can use them from LiveCode via shell():

audiowaveform
https://github.com/bbc/audiowaveform
(can also create the data as json file if you wish to make your own)

ffmpeg
https://www.ffmpeg.org , especially
https://trac.ffmpeg.org/wiki/Waveform

Makes not a waveform but a spectrogram:
SOX
http://sox.sourceforge.net

2. Or, very comfortable, but you have to wait until the browser widget supports Web Audio:
wavesurfer.js
https://wavesurfer-js.org
shiftLock happens

bernd59
Posts: 10
Joined: Sat Nov 11, 2017 12:21 pm

Re: AudioWaveform

Post by bernd59 » Wed Feb 28, 2018 7:05 am

thanks a lot!
so, I know that liveCode does not supports only play audio directly.
so, If I want to display an oszillogram and a spectrogram in Livecode at least for short audios it is the best way to calculate these osz-data and spec-data outside livecode, import these data and display them in my LiveCode app.??
Best
Bernd

[-hh]
VIP Livecode Opensource Backer
VIP Livecode Opensource Backer
Posts: 1785
Joined: Thu Feb 28, 2013 11:52 pm
Location: Göttingen, DE

Re: AudioWaveform

Post by [-hh] » Wed Feb 28, 2018 8:29 am

Yes. LiveCode would be much slower than these compiled CLIs which handle, BTW, nearly all audio formats.

For example SoX needs three seconds for a spectrogram of 9 MByte mp3:

1. Make a new stack of size 660x400 and create an image
2. Make a folder containing a sound file test.mp3

Code: Select all

On MouseUp
   put </path/to/folder> into f
   put "test.mp3" into mp3
   -- there are a lot of other options, see man page of sox:
   get shell ("cd f; sox " & mp3 & " -n spectrogram -Y 360 -x 480")
   set filename of img 1 to empty -- needed for a refresh
   set filename of img 1 to f&"/spectrogram.png"
end MouseUp
[You can then also play the sound with SoX via open process ...]
The rest of the GUI (incl. controls) is best done with LiveCode.
shiftLock happens

bernd59
Posts: 10
Joined: Sat Nov 11, 2017 12:21 pm

Re: AudioWaveform

Post by bernd59 » Wed Feb 28, 2018 9:21 am

great!
that helps me a lot!
thanks!
Bernd

Post Reply

Return to “Rich Media”