keith-43 / swiftbassdemo Goto Github PK
View Code? Open in Web Editor NEWThis Swift app uses the BASS audio library to render a real-time spectrum of a music file or live microphone input.
This Swift app uses the BASS audio library to render a real-time spectrum of a music file or live microphone input.
I've used your demo to test bass, but whenever I try to add my stream something weirds happens and I get error (not the only type, I also get "Left channel deserializing error")
2023-04-17 10:46:58.034224+0200 SwiftBassDemo[12842:130232] AACDecoder.cpp:200 Unmatched number of channel elements in payload
2023-04-17 10:46:58.036185+0200 SwiftBassDemo[12842:130232] AACDecoder.cpp:228 Error deserializing packet
2023-04-17 10:46:58.036515+0200 SwiftBassDemo[12842:130232] [ac] ACMP4AACBaseDecoder.cpp:1438 (0x157037840) Error decoding packet 1647: err = -1, packet length: 565
2023-04-17 10:46:58.036755+0200 SwiftBassDemo[12842:130232] [ac] ACMP4AACBaseDecoder.cpp:1442 '9E C7 42 30 50 8C 14 18 0C D0 4A A5 AA A6 40 BC 5E 5D D5 04 CB 0B A1 72 09 9D 1D D4 24 A9 CF 95 D4 4C C5 FF 3F 79 CB 63 C2 72 6A 08 4C 17 8C 47 30 98 E5 B7 39 74 0B 5B 88 9C 46 BF F4 63 A6 36 BF 0D 1F D4 E3 38 57 EA AE 8F 13 8A 29 EF 78 EA 3E 51 95 BD 2E 6B 65 05 DD 4A F5 C8 24 D1 52 5A 2E 1A 80 6A 65 30 1C 68 A7 67 93 22 2D 42 75 CB 97 47 C8 A9 BA 6D CA 7F D6 D0 9B 69 A6 34 8C 6D 05 F6 15 5C 89 E9 83 37 7D 1C F2 D0 10 9D 33 05 85 5E C2 DA A6 96 58 C2 02 70 0E 94 22 21 01 6C CE 50 5C EA 84 BF 39 4A E9 E2 E8 24 EF F2 F5 65 13 CE 87 2C BA 5E EF DB CB 3A 16 41 9E 79 D5 E5 65 29 E2 76 EC FF 92 92 22 31 A5 D3 80 41 12 25 F2 AD 92 C4 20 D8 4B 76 CA BA 0B A0 28 CF 60 4F C3 EA C9 CE 75 82 C5 ED DC 6E 5C B8 74 D3 DE 23 A7 CE 68 B4 D9 87 52 52 75 8F B3 0B 1D 11 4B 23 95 33 AA EF 2B 67 29 6C C0 E9 08 1C 51 F6 84 FD 3D 21 0D 40 3E 1C E8 3B 40 17 56 E8 23 C3 36 31 00 70 0F 19 4A 32 35 5C E5 50 2B B2 9E 36 EA 3D A1 F6 8F 8D ED 0F 7B 60 FF 80 C5 35 D8 01 FC 82 9E 8E D5 45 64 A1 D4 28 52 3B 04 42 03 2D 53 D9 5D E7 0E 69 14 21 A1 4B CB A0 81 74 B9 04 CE 6B F7 E9 D6 AA 96 0D B7 78 9B 31 F8 85 C9 C4 21 AD EE 23 11 86 51 BB E1 24 87 5A 98 69 B8 6A 7C D2 F4 88 A5 E8 A7 D8 DA 4D D1 39 F7 DE 4F 8D AB 4E E5 2E D2 94 96 BE C2 4A 67 97 C0 50 CB F3 52 03 99 55 00 07 16 38 DA EC 55 92 6E 59 29 DD 57 81 AA 63 B2 91 3C 1B 84 C8 9F 3B 2C 66 0A 25 C3 C3 D7 79 56 C8 F4 00 1D 39 D0 F4 E7 FB CE 91 66 07 29 CC 47 7F 31 08 E1 B4 37 B8 EA 75 FD 8B A1 00 14 00 07 A4 A9 7F ED E0 1F 4F F2 90 79 7D 4B AA E5 30 FF 59 B3 82 6B F9 4F A9 CB A7 78 2E FB A2'
2023-04-17 10:46:58.048406+0200 SwiftBassDemo[12842:130232] [ac] ACMP4AACBaseDecoder.cpp:1447 'EF 8D 60 7A 3F ED FE C8 DF 76 F5 DD 1F FD 71 46 5C 1F A5 07 5B 11 D9 80 D4 CB 00 F2 54 80 01 2D 9E 5F 3D E3 1F 9F 81 C8 31 12 7C CF F6 CE 59 56 CF 1F 19 55 55'
I've changed the following in the AudioManager.swift
var channel = HSTREAM()
channel = BASS_StreamCreateURL("https://stream10.xdevel.com/audio12s976748-1798/stream/icecast.audio", 0, 0, nil, nil);
/*
// Create a sample stream from our MP3 song file:
stream = BASS_StreamCreateFile( BOOL32(truncating: false), // mem: false = stream the file from a filename
filePath, // file:
0, // offset:
0, // length: 0 = use all data up to end of file
0) // flags:
*/
BASS_ChannelPlay(channel, -1) // starts the output
Another problem is that this is the only stream that's giving trouble, why is this problem happening?
EDIT: forgot to mention that the stream correctly starts, but fails after a while
First of all, thanks Keith for this demo app and the clear instructions.
I've followed them to install Bass in my own project.
I just have two questions:
For the first question, it appears that Bass doesn't identify Audio devices in the same way as MacOS. For example the built in speakers have an AudioDeviceID on my Mac Air of 64. Let's imagine for a moment this is not the default audio device. So I replace -1 in the Bass init with 64 (Converting first to the expected Int32). Nothing plays, so this obviously not how Bass recognises the device when it is not the default.
There is a BASS_GetInfos function; but I can't figure out how to call it form Swift. If I could get an array of devices as recognised by Bass, I could check the correspondence with the AudioDeviceID I want to use from MacOS.
For the second question I'm sure this must be possible. I'm just wondering if you know if anything is already built into Bass to facilitate this?
Thanks in advance for any advice you can give.
Geoff
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.