AudioWaveform
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
AudioWaveform
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
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
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: AudioWaveform
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
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
Re: AudioWaveform
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
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
-
- VIP Livecode Opensource Backer
- Posts: 2262
- Joined: Thu Feb 28, 2013 11:52 pm
- Location: Göttingen, DE
Re: AudioWaveform
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
[You can then also play the sound with SoX via open process ...]
The rest of the GUI (incl. controls) is best done with LiveCode.
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
The rest of the GUI (incl. controls) is best done with LiveCode.
shiftLock happens
Re: AudioWaveform
great!
that helps me a lot!
thanks!
Bernd
that helps me a lot!
thanks!
Bernd
Re: AudioWaveform
[-hh], thanks for the useful tip, I have looked for something like this for a while... I nevertheless cannot get your example working. I manage to create a spectrogram from within Terminal, but not from the Livecode Stack. I am working on MacOs X 10.12.6 with LC 9.5.
In Terminal I wrote: "/Users/oliver/Documents/development/waveform/sox /Users/oliver/Documents/development/waveform/test.aif -n spectrogram -Y 360 -x 480" and it works, but from within livecode it doesnt. Any tip?
I managed to get a simple file transformation to work from the LC stack:
Thanks
Oliver
In Terminal I wrote: "/Users/oliver/Documents/development/waveform/sox /Users/oliver/Documents/development/waveform/test.aif -n spectrogram -Y 360 -x 480" and it works, but from within livecode it doesnt. Any tip?
I managed to get a simple file transformation to work from the LC stack:
Code: Select all
get shell ("/Users/oliver/Documents/development/waveform/sox /Users/oliver/Documents/development/waveform/test.aif /Users/oliver/Documents/development/waveform/testnew.wav")
Thanks
Oliver
Last edited by okk on Wed Feb 26, 2020 10:34 am, edited 2 times in total.
Re: AudioWaveform
And a second question: I got the waveform generator that you mentioned in your post working on my computer. But how would this work in a standalone? I dont want that my users need to install audiowaveform and the required libraries. It wasn't the most smooth installtion anyway. Is it possible to copy all the needed files when creating the standalone? Thanks for any hint.
Oliver
Oliver