Convert Figma logo to code with AI

edc logobass

Make Bash utilities usable in Fish shell

2,200
70
2,200
13

Top Related Projects

10,675

Audio synthesis, processing, & analysis platform for iOS, macOS and tvOS

🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.

1,098

Pure Data embeddable audio synthesis library

1,229

Main repository for Csound

1,015

The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language.

Quick Overview

Bass is a lightweight, cross-platform audio library for C++. It provides a simple interface for playing and manipulating audio files, supporting various formats and offering features like 3D sound positioning and effects.

Pros

  • Easy to use API with minimal setup required
  • Cross-platform compatibility (Windows, macOS, Linux)
  • Supports multiple audio formats (MP3, OGG, WAV, etc.)
  • Low CPU usage and memory footprint

Cons

  • Limited documentation and examples
  • Not actively maintained (last update was several years ago)
  • Lacks advanced features found in more comprehensive audio libraries
  • Closed-source, which may be a drawback for some projects

Code Examples

  1. Playing a simple audio file:
#include "bass.h"

int main() {
    BASS_Init(-1, 44100, 0, 0, NULL);
    HSTREAM stream = BASS_StreamCreateFile(FALSE, "music.mp3", 0, 0, 0);
    BASS_ChannelPlay(stream, FALSE);
    // ... (wait for playback to finish)
    BASS_Free();
    return 0;
}
  1. Adjusting volume:
HSTREAM stream = BASS_StreamCreateFile(FALSE, "music.mp3", 0, 0, 0);
BASS_ChannelSetAttribute(stream, BASS_ATTRIB_VOL, 0.5f); // Set volume to 50%
  1. Using 3D positioning:
BASS_3DVECTOR pos = {0, 0, 0};
BASS_3DVECTOR vel = {0, 0, 0};
HSTREAM stream = BASS_StreamCreate(44100, 2, BASS_SAMPLE_3D, STREAMPROC_PUSH, 0);
BASS_ChannelSet3DPosition(stream, &pos, NULL, &vel);
BASS_Apply3D();

Getting Started

  1. Download the Bass library from the official website.
  2. Include the Bass header in your project:
    #include "bass.h"
    
  3. Link against the appropriate Bass library for your platform.
  4. Initialize Bass in your application:
    if (!BASS_Init(-1, 44100, 0, 0, NULL)) {
        // Error handling
    }
    
  5. Use Bass functions to play and manipulate audio.
  6. Clean up when done:
    BASS_Free();
    

Competitor Comparisons

10,675

Audio synthesis, processing, & analysis platform for iOS, macOS and tvOS

Pros of AudioKit

  • More comprehensive audio framework with a wider range of features
  • Actively maintained with frequent updates and a larger community
  • Extensive documentation and examples for easier implementation

Cons of AudioKit

  • Larger project size and potentially higher resource usage
  • Steeper learning curve due to its extensive feature set
  • May be overkill for simple audio tasks

Code Comparison

AudioKit:

import AudioKit

let oscillator = AKOscillator()
AudioKit.output = oscillator
try AudioKit.start()
oscillator.start()

Bass:

(ns my-audio-app
  (:require [bass.core :as bass]))

(bass/play-note :C4)

Summary

AudioKit is a more feature-rich and actively maintained audio framework, offering a wide range of capabilities for iOS and macOS development. It provides extensive documentation and examples, making it suitable for complex audio projects. However, its large size and comprehensive feature set may be excessive for simpler tasks.

Bass, on the other hand, is a lightweight Clojure library focused on basic audio synthesis. It offers a simpler API and is more suitable for quick audio experiments or projects with minimal audio requirements. However, it may lack the advanced features and community support found in AudioKit.

🇸Superpowered Audio, Networking and Cryptographics SDKs. High performance and cross platform on Android, iOS, macOS, tvOS, Linux, Windows and modern web browsers.

Pros of Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

  • Supports multiple platforms including mobile, desktop, and TV operating systems
  • Focuses on low-latency audio processing, which is crucial for real-time applications
  • Provides a comprehensive SDK for interactive audio development

Cons of Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform

  • May have a steeper learning curve due to its extensive feature set
  • Potentially larger footprint and resource usage compared to more focused audio libraries

Code Comparison

Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform:

SuperpoweredAdvancedAudioPlayer *player = new SuperpoweredAdvancedAudioPlayer(NULL, playerEventCallback, samplerate, 0);
player->open(filePath);
player->play(false);

Bass:

HSTREAM stream = BASS_StreamCreateFile(FALSE, "music.mp3", 0, 0, 0);
BASS_ChannelPlay(stream, FALSE);

Summary

The Low-Latency-Android-iOS-Linux-Windows-tvOS-macOS-Interactive-Audio-Platform offers a more comprehensive solution for cross-platform, low-latency audio development, while Bass provides a simpler API focused primarily on audio playback. The choice between the two depends on the specific requirements of the project, with the former being more suitable for complex, real-time audio applications across multiple platforms, and the latter being a good fit for simpler audio playback needs.

1,098

Pure Data embeddable audio synthesis library

Pros of libpd

  • Mature and widely-used library for embedding Pure Data in applications
  • Supports multiple platforms including iOS, Android, and desktop
  • Extensive documentation and community support

Cons of libpd

  • Larger codebase and potentially more complex integration
  • May have higher resource usage due to its comprehensive feature set
  • Learning curve for developers unfamiliar with Pure Data

Code Comparison

libpd example:

#include "z_libpd.h"

void setup() {
    libpd_init();
    libpd_openfile("patch.pd", ".");
}

bass example:

#include "bass.h"

void setup() {
    BASS_Init(-1, 44100, 0, 0, NULL);
    BASS_StreamCreateFile(FALSE, "music.mp3", 0, 0, 0);
}

Summary

libpd is a comprehensive solution for embedding Pure Data, offering cross-platform support and extensive features. It's ideal for projects requiring advanced audio processing capabilities. Bass, on the other hand, is more focused on audio playback and simpler to integrate, making it suitable for projects with straightforward audio requirements. The choice between the two depends on the specific needs of the project and the developer's familiarity with Pure Data.

1,229

Main repository for Csound

Pros of Csound

  • More comprehensive and feature-rich audio programming language
  • Longer development history and larger community support
  • Supports a wider range of audio synthesis and processing techniques

Cons of Csound

  • Steeper learning curve for beginners
  • More complex setup and configuration process
  • Larger codebase and potentially higher resource usage

Code Comparison

Csound example:

<CsoundSynthesizer>
<CsInstruments>
instr 1
  aSin poscil 0.5, 440
  out aSin
endin
</CsInstruments>
<CsScore>
i 1 0 5
</CsScore>
</CsoundSynthesizer>

Bass example:

(defn sine-wave [freq]
  (fn [t]
    (Math/sin (* t freq 2 Math/PI))))

(def audio (sine-wave 440))

Summary

Csound is a more powerful and versatile audio programming language with a longer history and larger community. It offers a wide range of audio synthesis and processing capabilities but comes with a steeper learning curve and more complex setup. Bass, on the other hand, is a simpler Clojure library for audio synthesis, which may be easier for beginners to grasp but has fewer features compared to Csound. The choice between the two depends on the specific requirements of the audio project and the user's experience level.

1,015

The Synthesis ToolKit in C++ (STK) is a set of open source audio signal processing and algorithmic synthesis classes written in the C++ programming language.

Pros of STK

  • More comprehensive audio synthesis toolkit with a wide range of instruments and effects
  • Actively maintained with regular updates and contributions
  • Extensive documentation and examples for easier implementation

Cons of STK

  • Larger codebase and potentially steeper learning curve
  • May include more features than necessary for simpler audio projects
  • C++ focused, which might not be ideal for all developers

Code Comparison

STK example (C++):

#include "SineWave.h"
#include "RtAudio.h"

StkFloat tick(void *outputBuffer, void *inputBuffer, unsigned int nBufferFrames) {
  SineWave sine;
  return sine.tick();
}

Bass example (C):

#include "bass.h"

HSTREAM stream;
stream = BASS_StreamCreateFile(FALSE, "music.mp3", 0, 0, 0);
BASS_ChannelPlay(stream, FALSE);

Summary

STK offers a more comprehensive audio toolkit with a focus on synthesis and instrument modeling, while Bass provides a simpler interface for audio playback and basic sound manipulation. STK is better suited for complex audio projects and synthesis, whereas Bass is more appropriate for straightforward audio playback and basic sound processing tasks.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Bass

Bass makes it easy to use utilities written for Bash in fish shell.

Regular bash scripts can be used in fish shell just as scripts written in any language with proper shebang or explicitly using the interpreter (i.e. using bash script.sh). However, many utilities, such as virtualenv, modify the shell environment and need to be sourced, and therefore cannot be used in fish. Sometimes, counterparts (such as the excellent virtualfish) are created, but that's often not the case.

Bass is created to make it possible to use bash utilities in fish shell without any modification. It works by capturing what environment variables are modified by the utility of interest, and replay the changes in fish.

You might not need Bass for simple use cases. A great simple alternative (suggested by @jorgebucaran) is to just use exec bash -c "source some-bash-setup.sh; exec fish".

Installation

Bass is compatible with fish versions 2.6.0 and later.

Manually

Use the Makefile.

make install will copy two files to ~/.config/fish/functions/.

make uninstall will remove those two files.

Relaunch the shell for the change to take effect.

With Oh My Fish

omf install bass

With Fisher

fisher install edc/bass

With Fundle

Add

fundle plugin 'edc/bass'

to your fish config, relaunch the shell and run fundle install.

Example

Bass is simple to use. Just prefix your bash utility command with bass:

> bass export X=3
> echo $X
3

Notice that export X=3 is bash syntax. Bass "transported" the new bash environment variable back to fish.

Bass has a debug option so you can see what happened:

> bass -d export X=4
# updating X=3 -> 4
set -g -x X 4

nvm

Here is a more realistic example, using the excellent nvm:

> bass source ~/.nvm/nvm.sh --no-use ';' nvm use iojs
Now using io.js v1.1.0

Note that semicolon is quoted to avoid being consumed by fish.

This example takes advantage of the nvm bash utility to switch to iojs. After the command, iojs is accessible:

> which iojs
/Users/edc/.nvm/versions/io.js/v1.1.0/bin/iojs

You can then very easily pack the command as a function and feel more at home:

> funced nvm
nvm> function nvm
           bass source ~/.nvm/nvm.sh --no-use ';' nvm $argv
       end

> nvm list
->  iojs-v1.1.0
         system
> nvm ls-remote
        v0.1.14
        v0.1.15
        
> funcsave nvm
...

(--no-use is an important option to nvm.sh. See #13 for background.)