SoundMaker 3.0.0

dotnet add package SoundMaker --version 3.0.0
                    
NuGet\Install-Package SoundMaker -Version 3.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="SoundMaker" Version="3.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="SoundMaker" Version="3.0.0" />
                    
Directory.Packages.props
<PackageReference Include="SoundMaker" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add SoundMaker --version 3.0.0
                    
#r "nuget: SoundMaker, 3.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package SoundMaker@3.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=SoundMaker&version=3.0.0
                    
Install as a Cake Addin
#tool nuget:?package=SoundMaker&version=3.0.0
                    
Install as a Cake Tool

SoundMakerCover
Pipeline

🗺️言語(Language)

  1. 日本語
  2. English

🎵概要

本ライブラリを用いると、以下の事が可能です。

  • チップチューンサウンド?を作成する
  • waveファイルにサウンドを書き込む

📑ドキュメント

Wiki

⛰️要件

.NET 8 以降

⏬インストール方法

NuGet

SoundMaker

🎶簡単な使い方

using SoundMaker;
using SoundMaker.Sounds;
using SoundMaker.Sounds.Score;
using SoundMaker.Sounds.SoundChannels;
using SoundMaker.WaveFile;

namespace YourNamespace;
public static class YourClass
{
    private static void Main()
    {
        // サウンドの形式を作成する。
        var builder = FormatBuilder.Create()
            .WithFrequency(48000)
            .WithBitDepth(16)
            .WithChannelCount(2);

        var soundFormat = builder.ToSoundFormat();
        StereoWave wave = MakeStereoWave(soundFormat);

        // ファイルに書き込む。
        var sound = new SoundWaveChunk(wave.GetBytes(soundFormat.BitRate));
        var waveFileFormat = builder.ToFormatChunk();
        var writer = new WaveWriter(waveFileFormat, sound);
        string filePath = "sample.wav";
        writer.Write(filePath);
    }

    private static StereoWave MakeStereoWave(SoundFormat format)
    {
        // 一分間の四分音符の個数
        int tempo = 100;
        // まず、音のチャンネルを作成する必要がある。
        // 現段階では矩形波、三角波、疑似三角波、ロービットノイズに対応している。
        var rightChannel = new SquareSoundChannel(tempo, format, SquareWaveRatio.Point25, PanType.Right)
        {
            // ISoundComponentを実装したクラスのオブジェクトをチャンネルに追加していく。
            // 現段階では普通の音符、休符、タイ、連符を使うことができる。
            new Note(Scale.C, 5, LengthType.Eighth, isDotted: true),
            new Tie(new Note(Scale.D, 5, LengthType.Eighth), LengthType.Eighth),
            new Tuplet(GetComponents(), LengthType.Quarter)
        };
        var rightChannel2 = new SquareSoundChannel(tempo, format, SquareWaveRatio.Point125, PanType.Right)
        {
            new Note(Scale.C, 4, LengthType.Eighth, isDotted: true),
            new Note(Scale.D, 4, LengthType.Quarter),
            new Rest(LengthType.Quarter)
        };
        var leftChannel = new TriangleSoundChannel(tempo, format, PanType.Left)
        {
            new Note(Scale.C, 3, LengthType.Eighth, isDotted: true),
            new Note(Scale.D, 3, LengthType.Quarter),
            new Rest(LengthType.Quarter)
        };

        var channels = new List<ISoundChannel>() { rightChannel, rightChannel2, leftChannel };
        // ミックスは'StereoMixer'クラスで行う。 
        return new StereoMixer(channels).Mix();
    }

    private static IReadOnlyList<BasicSoundComponentBase> GetComponents()
    {
        return new List<BasicSoundComponentBase>()
        {
            new Note(Scale.E, 5, LengthType.Eighth),
            new Note(Scale.F, 5, LengthType.Eighth),
            new Note(Scale.G, 5, LengthType.Eighth),
        };
    }
}


👀詳細

出力形式

サンプリング周波数

  • 48000Hz
  • 44100Hz

量子化ビット数

  • 16bit
  • 8bit

チャンネル数

  • Stereo 2ch
  • Monaural 1ch

🍄作った人のツイッター

Twitter(X)

©️ライセンス

MIT License

🎵Overview

You can do The following content with this library.

  • make the sound of chiptune
  • export sound to a file of wave format.

📑Documentation

Wiki

⛰️Requirement

.NET 8 or later

⏬Installation

NuGet

SoundMaker

🎶Usage

using SoundMaker;
using SoundMaker.Sounds;
using SoundMaker.Sounds.Score;
using SoundMaker.Sounds.SoundChannels;
using SoundMaker.WaveFile;

namespace YourNamespace;
public static class YourClass
{
    private static void Main()
    {
        // Create a sound format.
        var builder = FormatBuilder.Create()
            .WithFrequency(48000)
            .WithBitDepth(16)
            .WithChannelCount(2);

        var soundFormat = builder.ToSoundFormat();
        StereoWave wave = MakeStereoWave(soundFormat);

        // Write to a file.
        var sound = new SoundWaveChunk(wave.GetBytes(soundFormat.BitRate));
        var waveFileFormat = builder.ToFormatChunk();
        var writer = new WaveWriter(waveFileFormat, sound);
        string filePath = "sample.wav";
        writer.Write(filePath);
    }

    private static StereoWave MakeStereoWave(SoundFormat format)
    {
        // The number of quarter notes per minute
        int tempo = 100;
        // First, you need to create sound channels.
        // Currently, it supports square wave, triangle wave, pseudo-triangle wave, and low-bit noise.
        var rightChannel = new SquareSoundChannel(tempo, format, SquareWaveRatio.Point25, PanType.Right)
        {
            // Add objects of classes that implement ISoundComponent to the channel.
            // Currently, you can use normal notes, rests, ties, and tuplets.
            new Note(Scale.C, 5, LengthType.Eighth, isDotted: true),
            new Tie(new Note(Scale.D, 5, LengthType.Eighth), LengthType.Eighth),
            new Tuplet(GetComponents(), LengthType.Quarter)
        };
        var rightChannel2 = new SquareSoundChannel(tempo, format, SquareWaveRatio.Point125, PanType.Right)
        {
            new Note(Scale.C, 4, LengthType.Eighth, isDotted: true),
            new Note(Scale.D, 4, LengthType.Quarter),
            new Rest(LengthType.Quarter)
        };
        var leftChannel = new TriangleSoundChannel(tempo, format, PanType.Left)
        {
            new Note(Scale.C, 3, LengthType.Eighth, isDotted: true),
            new Note(Scale.D, 3, LengthType.Quarter),
            new Rest(LengthType.Quarter)
        };

        var channels = new List<ISoundChannel>() { rightChannel, rightChannel2, leftChannel };
        // Mixing is done by the 'StereoMixer' class. 
        return new StereoMixer(channels).Mix();
    }

    private static IReadOnlyList<BasicSoundComponentBase> GetComponents()
    {
        return new List<BasicSoundComponentBase>()
        {
            new Note(Scale.E, 5, LengthType.Eighth),
            new Note(Scale.F, 5, LengthType.Eighth),
            new Note(Scale.G, 5, LengthType.Eighth),
        };
    }
}

👀Features

Output format

Sampling frequency

  • 48000Hz
  • 44100Hz

Quantization bit rate

  • 16bit
  • 8bit

Number of Channels

  • Stereo 2ch
  • Monaural 1ch

🍄Author

Twitter(X)

©️License

SoundMaker is licensed under the MIT License.

Product Compatible and additional computed target framework versions.
.NET net8.0 is compatible.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed.  net9.0 was computed.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
  • net8.0

    • No dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.