element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Raspberry Pi
  • Products
  • More
Raspberry Pi
Raspberry Pi Forum Sinking two separate audio sources into default audio/pwm, as separate channels.
  • Blog
  • Forum
  • Documents
  • Quiz
  • Events
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join Raspberry Pi to participate - click to join for free!
Featured Articles
Announcing Pi
Technical Specifications
Raspberry Pi FAQs
Win a Pi
Raspberry Pi Wishlist
Actions
  • Share
  • More
  • Cancel
Forum Thread Details
  • State Verified Answer
  • Replies 4 replies
  • Answers 1 answer
  • Subscribers 664 subscribers
  • Views 1234 views
  • Users 0 members are here
  • pi
  • linux
Related

Sinking two separate audio sources into default audio/pwm, as separate channels.

Former Member
Former Member over 9 years ago

I want to get two mplayer streams (or a stream and a local file) - each already converted to mono L or R or single channel - into the onboard default pwm sound device using mixing, piping, permission forcing, whatever.  Goal being to get the 3.5mm jack to output two separate single channel (zone) audio outputs.  Music or voice, alt languages etc.  They do need to be able to happen simultaneously, as both may be used, but no sync between the two is necessary.

 

So far the nemesis is that the aduio device is only available to the first source that asks to use it.   I can, and do, in another application, output one stream to default, and one to usb/dac, but have a specific need to grab two streams out of (only) the 3.5mm for this one.  I'm a headless pi-type guy, all species, have most of my routines banked for debian/raspbian with audio mostly being alsa / mplayer / mpg321 handled with php-cli, shell, or python.  An alsa utility solution would be great but I've not been able to conceptualize and syntax one yet. 

 

I was appropriately accused of being overly verbose the other time I asked a question here, so let me leave it at this and respond, rather than type out the whole novel here.  (things have been tried, searches have been made, more complex and resource intensive methods have been conceptualized but put on hold unless necessary).

  • Sign in to reply
  • Cancel
  • mconners
    0 mconners over 9 years ago

    I'm certainly no expert in this area, but I was helping someone else with an issue they were having and stumbled across

     

    http://jackaudio.org/

     

    Have you looked into Jack?

     

    Mike

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Verify Answer
    • Reject Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to mconners

    Thank you Michael - no, I have no experience with this but have heard of it, and have begun looking thru it.

     

    If anyone knows this program and its set of functions, and sees a relationship between those, and my end goal, or has knowledge that its resource footprint is within the limits that these pi-type units have - your input would indeed be appreciated.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
  • Former Member
    0 Former Member over 9 years ago in reply to Former Member

    I thank you Michael - and I'm glad I took some time to learn those tools - it was time well spent.

     

    BUT, I found what I was looking for a bit closer to home.   If I had fully understood alsa, I would not have had to ask the question.

     

    But the ALSA native "dmix" and "dsnoop" plugins used in ~/.asoundrc handle it, as discussed here : http://stackoverflow.com/questions/14398573

     

    With that set up, streams/sources (even from separate PIDs/operations) sink just fine.

     

    mplayer STREAM1 -af pan=2:1:0    ("-af pan=2:1:0 " to downmix to single channel)

    mplayer STREAM2 -af pan=2:0:1    (using the other sink channel)

     

    And one plays out one channel of the 3.5mm Jack, and the other does so on the other.

     

    Regardless of order, delay, interruption, restart   A few tweeks for local file player (mpg321 etc) channel manipulation and I'll be at the place I was headed.

     

    Of course this setup requires attention be paid to blanked and sourced channels as it can very well play two sources simultaneously

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • Reject Answer
    • Cancel
  • sporex
    0 sporex over 7 years ago in reply to Former Member

    Additional question please, because I'am concerned with a similar problem:

    - if I got the discussion right, it's about using one ALSA device (in this case the 3,5mm audio jack) with two different instances of software, where one is using the left channel and the other is using the right channel?

    - my goal is to simply run the ALSA speaker-test utility as two independent instances as a sine wave generator where one goes to left, the other to right.
    Instance (1) : speaker-test -D plughw:2,0 -t sine -f 891&      # goes to the left channel of the 3,5mm audio jack
    Instance (2) : speaker-test -D plughw:2,1 -t sine -f 920&      # goes to the right channel of the 3,5mm audio jack

    - with the default configuration I get the error message that the resource is busy, upon invoking Instance(2)

    I dont know weather your approach could possibly solve this issue?

    Kindly CS


    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • Verify Answer
    • Cancel
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube