Page 1 of 2

Distorted sound

Posted: Tue Jan 23, 2018 11:22 pm
by yeldarb
Audio playback via the "play <filepath>" command produces distortion when trying to play mp3 or AAC (m4a) files. Works ok with a WAV.

Tried various settings, output from Audacity and other MP3s I have.

Running LC 8.1.7 on Mac 10.13.2.

Re: Distorted sound

Posted: Tue Jan 23, 2018 11:46 pm
by Klaus
Hi yeldarb,

the "play" command on desktop is quite old and VERY picky!

You can only "PLAY" uncompressed AIF and WAV files and the (compressed by nature) AU file format. Everything else will produce white noise, as you have experienced.

Since you can only play ONE sound at a time with the play command, using a player-object is the way to go with sounds (and video, of course)!


Best

Klaus

Re: Distorted sound

Posted: Tue Jan 23, 2018 11:55 pm
by yeldarb
Would be nice to have that documented. This page:

http://livecode.byu.edu/audio/audioplayback-mobile.php

clearly implies the play command will work with mp3s:
For playing back a single sound file the simplest method is to use the play command. The syntax is straightforward:

play path-to-sound-file
So if you keep your sound files in a folder called "sounds" in the same folder as your app, in a script it might look something like this:

put specialFolderPath("resources") & slash & "sounds" & slash & "boing.mp3" into tSound
play tSound

Re: Distorted sound

Posted: Wed Jan 24, 2018 12:29 am
by Klaus
yeldarb wrote:
Tue Jan 23, 2018 11:55 pm
...
This page:
http://livecode.byu.edu/audio/audioplayback-mobile.php
clearly implies the play command will work with mp3s:...
Yes, these formats work on MOBILE, just like the webpage says -> audioplayback-mobile.php! 8)

Re: Distorted sound

Posted: Wed Jan 24, 2018 5:41 pm
by tomBTG
Hi,
I have found these settings produce audio files that play without distortion for LC on desktop machines:
16-bit, 44100 Hz sample rate, mono.

Better?

Tom B.
yeldarb wrote:
Tue Jan 23, 2018 11:22 pm
Tried various settings, output from Audacity and other MP3s I have.

Running LC 8.1.7 on Mac 10.13.2.

Re: Distorted sound

Posted: Wed Jan 24, 2018 7:21 pm
by yeldarb
Tom, thanks, are you referring to exporting as MP3? I resampled to 16 bit 44.1khz and then exported to MP3,
still distorted.
tomBTG wrote:
Wed Jan 24, 2018 5:41 pm
Hi,
I have found these settings produce audio files that play without distortion for LC on desktop machines:
16-bit, 44100 Hz sample rate, mono.

Better?

Tom B.
yeldarb wrote:
Tue Jan 23, 2018 11:22 pm
Tried various settings, output from Audacity and other MP3s I have.

Running LC 8.1.7 on Mac 10.13.2.

Re: Distorted sound

Posted: Wed Jan 24, 2018 7:28 pm
by Klaus
yeldarb wrote:
Wed Jan 24, 2018 7:21 pm
...are you referring to exporting as MP3?
Surely not, see my first posting. 8)
MP3 only work on Desktop in a player object, but on mobile also with "play <path to mp3>"

Re: Distorted sound

Posted: Wed Jan 24, 2018 9:37 pm
by tomBTG
yeldarb wrote:
Wed Jan 24, 2018 7:21 pm
Tom, thanks, are you referring to exporting as MP3? I resampled to 16 bit 44.1khz and then exported to MP3, still distorted.
I've "cured" the distortion in both wav and mp3 files using those settings. I am using a Player object in LC 7.x to play the audio. I'm on Windows (no QT installed).

Tom

Re: Distorted sound

Posted: Wed Jan 24, 2018 9:41 pm
by Klaus
tomBTG wrote:
Wed Jan 24, 2018 9:37 pm
...
I am using a Player object in LC 7.x to play the audio.
We are talking about the PLAY command on desktop! 8)

Re: Distorted sound

Posted: Thu Jan 25, 2018 4:47 pm
by yeldarb
So what I'm hearing is to avoid beating my head against a bunch of limitations, I should probably just use a player object.

Re: Distorted sound

Posted: Thu Jan 25, 2018 5:01 pm
by Klaus
Yep, that's the bottom line of this thread. :D

Re: Distorted sound

Posted: Thu Jan 25, 2018 5:48 pm
by bogs
No, this is the bottom line of this thread is actually

Return to “Getting Started with LiveCode - Experienced Developers”

:wink:

Re: Distorted sound

Posted: Thu Jan 25, 2018 6:22 pm
by Klaus
Hey dude, nobody likes wisenheimer! :D

Re: Distorted sound

Posted: Thu Jan 25, 2018 7:17 pm
by yeldarb
:|












:lol:

Re: Distorted sound

Posted: Thu Jan 25, 2018 8:51 pm
by Klaus
That was targeted to Mr. Bogs actually. :D