summaryrefslogtreecommitdiff
path: root/nix_archive/nix/audio.nix
blob: adac55be80448495a2c5716d05a7fa5e396b95a2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
{ pkgs, ... }: {
  #hardware.pulseaudio = {
  #  enable = true;
  #  support32Bit = true;
  #};
  #nixpkgs.config.pulseaudio = true;
  services.pipewire = {
    enable = true;
    pulse.enable = true;
    alsa.enable = true;
    alsa.support32Bit = true;
    extraConfig = {
      # cat /proc/asound/card1/stream0
      pipewire = {
        "92-user" = {
          "context.properties" = {
            "default.clock.rate" = 48000;
            "default.clock.allowed-rates" = [ 44100 48000 88200 96000 176400 192000 352800 384000 ];
            "default.clock.quantum" = 512;
            "default.clock.min-quantum" = 32;
            "default.clock.max-quantum" = 4096;
            "default.clock.quantum-limit" = 4096;
            "default.video.width" = 640;
            "default.video.height" = 480;
            "default.video.rate.num" = 25;
            "default.video.rate.denom" = 1;
          };
          "context.modules" = [{
            "name" = "libpipewire-module-filter-chain";
            "args" = {
              "node.description" = "Focal Elegia EQ (Convolver)";
              "media.name" = "Focal Elegia EQ (Convolver)";
              "filter.graph" = {
                "nodes" = [{
                  "type" = "builtin";
                  "name" = "Convolver EQ";
                  "label" = "convolver";
                  "config" = {
                    "filename" = [
                      "/etc/convolver/Focal_Elegia_minimum_phase_44100Hz.wav"
                      "/etc/convolver/Focal_Elegia_minimum_phase_48000Hz.wav"
                    ];
                    "resample_quality" = 10;
                  };
                }];
              };
              "capture.props" = {
                "node.name" = "eq_input.elegia_convolver_eq";
                "media.class" = "Audio/Sink";
                "audio.channels" = 2;
                "audio.position" = [ "FL" "FR" ];
              };
              "playback.props" = {
                "node.name" = "eq_output.elegia_convolver_eq";
                "node.passive" = true;
                "audio.channels" = 2;
                "audio.position" = [ "FL" "FR" ];
              };
            };
          }];
          "stream.properties" = {
            "resample.quality" = 10;
            "channelmix.normalize" = false;
          };
        };
      };
      client = {
        "92-client-user" = {
          "stream.properties" = {
            "resample.quality" = 10;
            "channelmix.normalize" = false;
          };
        };
      };
      pipewire-pulse = {
        "92-pulse-user" = {
          "pulse.properties" = {
            "pulse.default.format" = "S32";
            "pulse.default.position" = [ "FL" "FR" ];
          };
          "stream.properties" = {
            "resample.quality" = 10;
            "channelmix.normalize" = false;
          };
        };
      };
    };
    wireplumber = {
      enable = true;
      extraConfig = {
        "alsa-conf" = {
          "monitor.alsa.properties" = {
            "alsa.use-acp" = true;
          };
          "wireplumber.profiles" = {
            "main" = {
              "monitor.alsa.reserve-device" = "disabled";
            };
          };
        };
      };
    };
  };
  environment.systemPackages = with pkgs; [
    pipewire
    pavucontrol
  ];
  environment.etc = {
    "convolver/Focal_Elegia_minimum_phase_44100Hz.wav".source = ../../files/audio/convolver/Focal_Elegia_minimum_phase_44100Hz.wav;
    "convolver/Focal_Elegia_minimum_phase_48000Hz.wav".source = ../../files/audio/convolver/Focal_Elegia_minimum_phase_48000Hz.wav;
  };
  security.rtkit.enable = true;
}