Distorted sound

LiveCode is the premier environment for creating multi-platform solutions for all major operating systems - Windows, Mac OS X, Linux, the Web, Server environments and Mobile platforms. Brand new to LiveCode? Welcome!

Moderators: heatherlaine, Klaus, FourthWorld, robinmiller, kevinmiller

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Distorted sound

Post by yeldarb » Tue Jan 23, 2018 11:22 pm

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.

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Tue Jan 23, 2018 11:46 pm

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

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Re: Distorted sound

Post by yeldarb » Tue Jan 23, 2018 11:55 pm

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

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Wed Jan 24, 2018 12:29 am

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)

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 51
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City
Contact:

Re: Distorted sound

Post by tomBTG » 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.

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Re: Distorted sound

Post by yeldarb » 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.
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.

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Wed Jan 24, 2018 7:28 pm

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>"

tomBTG
Livecode Opensource Backer
Livecode Opensource Backer
Posts: 51
Joined: Fri Nov 25, 2011 6:42 pm
Location: Kansas City
Contact:

Re: Distorted sound

Post by tomBTG » Wed Jan 24, 2018 9:37 pm

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

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Wed Jan 24, 2018 9:41 pm

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)

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Re: Distorted sound

Post by yeldarb » Thu Jan 25, 2018 4:47 pm

So what I'm hearing is to avoid beating my head against a bunch of limitations, I should probably just use a player object.

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Thu Jan 25, 2018 5:01 pm

Yep, that's the bottom line of this thread. :D

bogs
Posts: 2198
Joined: Sat Feb 25, 2017 10:45 pm

Re: Distorted sound

Post by bogs » Thu Jan 25, 2018 5:48 pm

No, this is the bottom line of this thread is actually

Return to “Getting Started with LiveCode - Experienced Developers”

:wink:
Image

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Thu Jan 25, 2018 6:22 pm

Hey dude, nobody likes wisenheimer! :D

yeldarb
Posts: 43
Joined: Thu Dec 14, 2017 5:39 pm

Re: Distorted sound

Post by yeldarb » Thu Jan 25, 2018 7:17 pm

:|












:lol:

Klaus
Posts: 10327
Joined: Sat Apr 08, 2006 8:41 am
Location: Germany
Contact:

Re: Distorted sound

Post by Klaus » Thu Jan 25, 2018 8:51 pm

That was targeted to Mr. Bogs actually. :D

Post Reply

Return to “Getting Started with LiveCode - Experienced Developers”