![]() |
#226 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
ALSACTL - Let's have a peek then
SO..... in order to maintain the thread OT. The FFT Debate - and work tranche has been shoveled across to Reworking FFT code
================================================== ======== Back to the crux of the thread: Making the sound setup do things we want! Let's have a quick play with alsactl Let's have a look at a vaguely relevant man page http://linux.die.net/man/1/alsactl okay, done that? onwards... The version on the kindle is wee bit old: Code:
[root@kindle bin]# alsactl --version alsactl version 1.0.13 Code:
[root@kindle root]# alsactl store -f /mnt/us/opt/sound/alsactl.state Here's the output of my alsactl.state - AS IS unamended on a k3gWifi (the popular name used is asound.state, I prefer my name. call it what you want) Spoiler:
As ever filled with much unexciting dross, but there are maybe a few goodies in there for us to twiddle: To determine exactly which thing each setting refers to look under the name attribute for example: mx35luigi {control.1 is in fact: name 'Capture Volume'. The type of access this value has is defined as read write for all controls The complete valid enumeration set is not available with the document. Setting the default values for some of the things could come in handy. Some of them have two value attributes. (some, seemingly with duped info.) Others have more obvious - single - value settings. The count of expected values is self-described under comment.count For example: 2 The expected values Types are conveniently self-describing and can be found under comment.type For example: INTEGER Where enumerations are used - i.e: ENUMERATED then a comment.item.[0indexing++] scheme is used: For example: comment.item.0 ALC comment.item.1 Limiter This is further backed up by a range attribute comment.range For example '0 - 63' The interface is shared by all iface MIXER and this more than likely refers to something in the alsa.conf somewhere. That covers the schema for the document I believe. So, what does this let us do? well if we have a quick look at the alsactl --help Code:
Usage: alsactl <options> command Available options: -h,--help this help -f,--file # configuration file (default /etc/asound.state or /etc/asound.names) -F,--force try to restore the matching controls as much as possible -d,--debug debug mode -v,--version print version of this program Available commands: store <card #> save current driver setup for one or each soundcards to configuration file restore<card #> load current driver setup for one or each soundcards from configuration file Next steps? a)Decide what make-it-more-awesome values we need - if any b) check the restore doesn't exhibit strange behavior and works as expected. That about wraps it up for how-to Store and fiddle around. We can amend the values and using the alsactl restore [blah] Last edited by twobob; 07-18-2012 at 11:16 AM. Reason: added a man ref. |
![]() |
![]() |
![]() |
#227 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Spoooky weirdness.
For no reason that I can fathom the soundcard decided to play the buffer at the wrong rate. The next time (after digging around for erronous code) it played at the right rate. And all subsequent times Here there may be dragons. |
![]() |
![]() |
![]() |
#228 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
Anything with the complexity level of modern hardware devices and software libraries (like alsa) is going to be plagued with hidden weirdness in the seldom explored corners, that clever programming can usually hide from the consumer (in most "general usage" cases). But then again, it is those very weird behaviors that can often be exploited to root a device and add features to it. ![]() |
|
![]() |
![]() |
![]() |
#229 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
root 19 -1 24340 13m 988 S 27.6 5.4 0:27.38 Balsamic
Running without any Graphics updates, looping the video thread insanely. (I'll try one with the thread elided next for sanity) circa 25% Cpu usage on a 44100 File running in stereo. |
![]() |
![]() |
![]() |
#230 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
root 19 -1 16148 13m 976 S 1.0 5.4 0:01.24 Balsamic
1% without the stupidly looping thread. 2% at a peak occasionally. Plays solid now with no seggies. I think we can call that "Done". NOTE: if someone wants to implement mmap that may indeed yield better results. But one caveat of mmap is you MUST use the hw level Pcm_writei callls otherwise all advantages are lost as the "Helper" methods of the the newer "higher level" functions do not manage the memory shifting in the way you might think. |
![]() |
![]() |
![]() |
#231 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
|
|
![]() |
![]() |
![]() |
#232 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
![]() Although we have overlap in our projects and methods, this is still a shared effort that we are all contributing to. You continue the robust version, and I will continue the tiny minimal demo version. And thanks for getting me started on the path to full simultaneous (hopefully glitch-free) audio on all the (sound enabled) kindles. ![]() That "minimum init" version sure looks "familiar". It is based on the same alsa example source code as the "noisy rhythms" demo (except that I condensed mine). ![]() I still like the condensed version better, but there are plenty of folks who like all that whitespace and may actually need all those comments to tell them that the open function does "open it" and the "set params" function does "init it" and the write function does "write to it" and the close function does "close it". My version without those comments could be difficult to figure out if you do not read the function names. And variable names like "buf" might mean "buffalo" instead of "buffer" so using abbreviated variable names could also lead to misunderstanding. ![]() Last edited by geekmaster; 07-18-2012 at 05:00 PM. |
|
![]() |
![]() |
![]() |
#233 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
I tend to agree your abbreviated version has merit and should probably get a top-post mention at some point on this thread when it has reached it's logical end. I just went with the Alsa examples for now, tidy it up later.
Very happy to be involved in this project, what little that can be offered by my camp is freely given. Today I shall be mainly wasting many many many hours getting demos and configs configured. Oh I already did. : \ Hehehe I'm on with multiple rate / channel / bit support actually. dull but ultimately rewarding. Come the day I can see and hear some stuff on this thing (aside from the crazy squiggle graphics I been making from the audio streams) neatly synced? That will be a great thing and a great day. |
![]() |
![]() |
![]() |
#234 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
indexer = 4096*(playcount * WaveChannels * (WaveBits/16) * 2);
should sort the multi - bit - channel - rate issue. Where 4096 is the maximum amount of frames the card will allow stacked. Should handle most - normalish - rate wav files now - mono or stereo - 8 or 16 bit. I changed the call to the thread - now with a NULL message Type. (The thread warning about the messageType being of an inconsistent type still puzzles me, I have checked it against the parent method, NULL seems the least unhappy) I'll post my silly test code here in a moment. No more seggies through running off the end of the file or threads not ending together while (4096*(playcount)< WaveSize) Sorted that out. Last edited by twobob; 07-18-2012 at 10:13 PM. Reason: added support specifications |
![]() |
![]() |
![]() |
#235 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
In the absence of FFT
EDIT:
I AM WORKING ON THE FP ERROR AT THE MOMENT... It seems happier called via SSH for some reason I can't fathom yet. Does not like MyTs for some reason... so as reported below until I crack this bug YMMV. END EDIT Like GM said - use your imagination.... So I did. I give you "Balsamic" Version 0.0.0.1 Features: (Almost none ![]() Plays a 8 or 16 bit WAV file (most normal uncompressed rates should work okay) in mono or stereo. Does a music to visual display (Nothing mind blowing but it's fairly matrix) THAT IS UNIQUE FOR EACH SONG. (It should appear linked to the track content) That is LINKED TO THE MUSIC (I had to make a few sacrifices - FFT one day) THAT does UNIQUE things per play of a song (or I think it does possibly lol) (perhaps a RANDOM might now hurt but I like the purity of being modulated data-driven) that's about it for now. Enjoy. Thanks to Knc1 for helping me get where I am with the project so far. Kek has been a huge help, so has he on many levels - not least of which helping me getting the thing compiled. Thanks to GM for access to his library for the video and assistance with the tech aspects of this - and other related - projects. Apologies for the clear and present abuse of the code mate. ; ) I have included the original - pre remix master - of a track called "Nameless Road To Nowhere" by Mr Dodo. Don't worry, I've got the rights and Matt won't mind. Enjoy. Any track will do (Note: I did not shamelessly include one of my own tunes, nor did I post the remix I did of this tune... Just saying like. If you want my stuff go dig in my sigi, ta.) Balsamic. Feel free to mash it up to pieces, it's only code. I added notes : ) USAGE: ./Balsamic noise.wav Spoiler:
Last edited by twobob; 07-19-2012 at 11:05 PM. Reason: added bug report info |
![]() |
![]() |
![]() |
#236 | |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
Quote:
You may want to duplicate the copyright line and add your own name (so we are both listed). Last edited by geekmaster; 07-18-2012 at 11:59 PM. |
|
![]() |
![]() |
![]() |
#237 |
Carpe diem, c'est la vie.
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,433
Karma: 10773670
Join Date: Nov 2011
Location: Multiverse 6627A
Device: K1 to PW3
|
To avoid sound problems (like this floating point exception), I am tempted to just pipe sound through GMPLAY out STDOUT to aplay for the next version of my video player. But I really like "more portable" direct sound control if simple and reliable. At least all the kindles have aplay...
Instead of full FFT, you can get an FFT-like demo by just using the time between zero-crossings as an index into an array of bucket counters, then periodically plot the values in the bucket (zero-cross period vs. counts). The visible effect is much like you would get with an FFT spectrograph, but with very little code. I did that on an Apple-2 ages ago. I will do that on my kindle if you don't do it. I may do it even if you DO do it. ![]() And yes, you really SHOULD keep the 8-bit framebuffer code working too. I would break their loops and call them to do each single frame. Then your custom code can be OUTSIDE gmplay4 and gmplay8 where it belongs. Last edited by geekmaster; 07-19-2012 at 12:10 AM. |
![]() |
![]() |
![]() |
#238 | |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Quote:
I noticed that today via myts. it was testing okay via SSH. I'm looking into it. Spent all day analysing docs. the least exciting thing in the world possibly. Back to the grind in the AM. the face is calling me! ![]() Re the code and copyrights, I promise to make the final version proper and tidy . the 0.0.0.1 should really have been called: THE PRE PRE PRE ALPHA STILL A RIGHT BLOODY MESS BECAUSE ITS **AM AND I'M TIRED! RELEASE Bloody hobbyists ey. : ) I'll tidy it up. Cheers |
|
![]() |
![]() |
![]() |
#239 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
Hmm. I can't seem to get it to dump via SSH.
Only unhappy in myTs... This should probably tell me something. Working on it.. EDIT: Okay I can get it seg at will via gdb. Program received signal SIGSEGV, Segmentation fault. [Switching to Thread 1084507280 (LWP 5166)] 0x0000a840 in gmplay4 () at ../Balsamic.c:96 96 ../Balsamic.c: No such file or directory. in ../Balsamic.c So it is actually dumping inside the vid call seemingly, and running it via gdb does in fact allow the entire track to keep playing and just the video thread to halt. Must be looking for a value that doesn't exist or not exiting the video thread early enough. It's something stupid anyway, not related to audio solidity as far as I can make out so far so happy days on that - I'll rip the graphics and see if it still dumps. And Backtrace gives us... (gdb) bt #0 0x0000a840 in gmplay4 () at ../latency.c:96 #1 0x400389c8 in start_thread () from /lib/libpthread.so.0 #2 0x4019c4e8 in clone () from /lib/libc.so.6 Backtrace stopped: frame did not save the PC Hmm. perhaps I should have built it -g... *does some research* EDIT: hmm i built it -g3 Ahh this looks a lot like: http://stackoverflow.com/questions/7...braries-on-arm Did we build the shared library -fomit-frame-pointer ??? Umm... *scratches head* - I'll try dumping the optimisations in the build EDIT: Nope that didn't help -O0 and -g3 Better check the alsa libs build. sigh... Last edited by twobob; 07-20-2012 at 12:14 PM. Reason: added some extry thoughts. |
![]() |
![]() |
![]() |
#240 |
( ͡° ͜ʖ ͡°){ʇlnɐɟ ƃǝs}Tır
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() Posts: 6,586
Karma: 6299993
Join Date: Jun 2012
Location: uti gratia usura (Yao ying da ying; Mo ying da yieng)
Device: PW-WIFI|K5-3G+WIFI| K4|K3-3G|DXG|K2| Rooted Nook Touch
|
rebuilding with --static gives us
Program received signal SIGSEGV, Segmentation fault. [Switching to LWP 12827] 0x0000b708 in gmplay4 () at ../Balsamic.c:83 83 ../Balsamic.c: No such file or directory. in ../Balsamic.c (gdb) bt #0 0x0000b708 in gmplay4 () at ../Balsamic.c:83 #1 0x00094a60 in start_thread () #2 0x000e2588 in ?? () hmmm EDIT: AHH! That old chestnut. Starting program: /mnt/us/opt/sound/Balsamic kalia.wav warning: Cannot initialize thread debugging library: unknown thread_db error '22' warning: Unable to find dynamic linker breakpoint function. GDB will be unable to debug shared library initializers and track explicitly loaded dynamic code. Balsamic Main: creating Video thread 0 Sigh. Gah. I really really have got to do a 32 bit build this is driving me nuts. Last edited by twobob; 07-20-2012 at 02:32 PM. Reason: added AHH! |
![]() |
![]() |
![]() |
Tags |
stupid root mistakes |
|