Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
Initial upload
  • Loading branch information
smallbutfine authored Jun 25, 2023
1 parent 89d6806 commit bbd9ed4
Show file tree
Hide file tree
Showing 8 changed files with 1,180 additions and 0 deletions.
69 changes: 69 additions & 0 deletions neural.lfm
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
object MainForm: TMainForm
Left = 530
Height = 611
Top = 632
Width = 891
Caption = 'Neural Amp Cenrtral'
ClientHeight = 581
ClientWidth = 891
DesignTimePPI = 144
Menu = MainMenu1
LCLVersion = '2.2.6.0'
object MemConsole: TRichMemo
Left = 16
Height = 344
Top = 216
Width = 865
HideSelection = False
TabOrder = 0
ZoomFactor = 1
end
object NAMButton: TButton
Left = 256
Height = 86
Top = 88
Width = 374
Caption = 'NAM!!!'
Color = clForm
OnClick = NAMButtonClick
ParentFont = False
TabOrder = 1
end
object MainMenu1: TMainMenu
Left = 51
Top = 24
object MenuItem2: TMenuItem
Caption = '&File'
object MenuItem7: TMenuItem
Caption = '-'
end
object MenuItem10: TMenuItem
Caption = '-'
end
object MenuItem11: TMenuItem
Caption = 'E&xit'
end
end
object MenuItem15: TMenuItem
Caption = '&Help'
object MenuItem18: TMenuItem
Caption = '&Online Help'
end
object MenuItem19: TMenuItem
Caption = '-'
end
object MenuItem20: TMenuItem
Caption = '&Licence Information'
end
object MenuItem21: TMenuItem
Caption = '&Check for Updates'
end
object MenuItem22: TMenuItem
Caption = '-'
end
object MenuItem23: TMenuItem
Caption = '&About'
end
end
end
end
156 changes: 156 additions & 0 deletions neural.pas
Original file line number Diff line number Diff line change
@@ -0,0 +1,156 @@
unit neural;

{$mode objfpc}{$H+}

interface

uses
Classes, SysUtils, FileUtil, process, Forms, Controls, Graphics, Dialogs, Menus,
StdCtrls, RTTICtrls, RichMemo, Zipper, Processutils;

type

{ TMainForm }

TMainForm = class(TForm)
MainMenu1: TMainMenu;
MemConsole: TRichMemo;
MenuItem10: TMenuItem;
MenuItem11: TMenuItem;
MenuItem15: TMenuItem;
MenuItem18: TMenuItem;
MenuItem19: TMenuItem;
MenuItem2: TMenuItem;
MenuItem20: TMenuItem;
MenuItem21: TMenuItem;
MenuItem22: TMenuItem;
MenuItem23: TMenuItem;
MenuItem7: TMenuItem;
NAMButton: TButton;
procedure NAMButtonClick(Sender: TObject);

private

public
procedure ProcessOutput(Sender:TProcessEx; output:string);
procedure ProcessError(Sender:TProcessEx; {%H-}IsException:boolean);

end;

var
MainForm: TMainForm;

implementation

{$R *.lfm}

{ TMainForm }


procedure TMainForm.NAMButtonClick(Sender: TObject);

var
Proc: TProcessEx;
namrunner:TextFile;
begin
//StartProcessAndStreamStdioToMemo('NAM-Runner.bat',MemConsole)
AssignFile(namrunner, 'NAM-Runner060.bat');
// Try
Rewrite(namrunner);
Writeln(namrunner,'');//Remember AnsiStrings are case sensitive
Writeln(namrunner,'@echo off');
Writeln(namrunner,'set NAMNAME=neural-amp-modeler-0.6.0');
Writeln(namrunner,'set NAMVER=0.6.0');
Writeln(namrunner,'if exist "%~dp0\%NAMNAME%\installed.txt" (');
Writeln(namrunner,'echo NAM already installed!');
Writeln(namrunner,'GOTO NAMISINSTALLED');
Writeln(namrunner,')');
Writeln(namrunner,'echo This program is downloading and installing the complete NAM modelling environment and all prerequisites and runtimes.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo PLEASE BE PATIENT.');
Writeln(namrunner,'echo SOME PARTS OF THIS INSTALLATION PROCESS CAN TAKE QUITE SOME TIME!');
Writeln(namrunner,'echo DON''T CLOSE THIS WINDOW UNTIL YOU ARE ASKED TO DO IT.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo Downloading and extracting Python archive...');
Writeln(namrunner,'curl -L https://github.com/winpython/winpython/releases/download/6.1.20230527/Winpython64-3.10.11.1dot.exe -o python.exe');
Writeln(namrunner,'if exist "%~dp0\%NAMNAME%" rmdir /q "%~dp0\%NAMNAME%"');
Writeln(namrunner,'python.exe -y');
Writeln(namrunner,'@echo. |call %~dp0\WPy64-310111\scripts\make_winpython_movable.bat');
Writeln(namrunner,'move /Y "%~dp0\WPy64-310111\python-3.10.11.amd64" "%NAMNAME%"');
Writeln(namrunner,'echo Removing Python archive and unused files...');
Writeln(namrunner,'del /f /s /q "%~dp0\WPy64-310111" 1>nul');
Writeln(namrunner,'rmdir /s /q "%~dp0\WPy64-310111"');
Writeln(namrunner,'del python.exe');
Writeln(namrunner,'echo Done.');
Writeln(namrunner,'cd %NAMNAME%');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'set PYTHONPATH=%~dp0\%NAMNAME%;%~dp0\%NAMNAME%\DLLs;%~dp0\%NAMNAME%\lib;%~dp0\%NAMNAME%\lib\plat-win;%~dp0\%NAMNAME%\lib\site-packages');
Writeln(namrunner,'set PATH=%~dp0%NAMNAME%;%~dp0%NAMNAME%\Scripts;%PATH%');
Writeln(namrunner,'echo Upgrading PIP...');
Writeln(namrunner,'python.exe -m pip install --upgrade pip');
Writeln(namrunner,'echo Done.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo Installing NAM...');
Writeln(namrunner,'python -m pip install neural-amp-modeler==%NAMVER%');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo Installing torch gpu...');
Writeln(namrunner,'pip3 install scipy==1.10.1');
Writeln(namrunner,'pip3 install torch torchvision torchaudio --force-reinstall --index-url https://download.pytorch.org/whl/cu118');
Writeln(namrunner,'echo Done.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'>"%~dp0%NAMNAME%\installed.txt" echo done');
Writeln(namrunner,'echo NAM install done.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo.');
Writeln(namrunner,':NAMISINSTALLED');
Writeln(namrunner,'set PYTHONPATH=%~dp0\%NAMNAME%;%~dp0\%NAMNAME%\DLLs;%~dp0\%NAMNAME%\lib;%~dp0\%NAMNAME%\lib\plat-win;%~dp0\%NAMNAME%\lib\site-packages');
Writeln(namrunner,'set PATH=%~dp0%NAMNAME%;%~dp0%NAMNAME%\Scripts;%PATH%');
Writeln(namrunner,'python -c "from winpython import wppm;dist=wppm.Distribution(r''%~dp0\%NAMNAME%'');dist.patch_standard_packages(''pip'', to_movable=True)"');
Writeln(namrunner,'nam');
Writeln(namrunner,'');
Writeln(namrunner,'cd..');
Writeln(namrunner,'echo.');
Writeln(namrunner,'echo.');
Writeln(namrunner,'::echo This window can now be closed.');
Writeln(namrunner,'echo In case something went wrong or the installation got corrupted:');
Writeln(namrunner,'echo You can simply delete the folder %NAMNAME% and try a reinstall.');
Writeln(namrunner,'echo Note, that a reinstallation needs an internet connection.');
Writeln(namrunner,'echo Thank you.');
//Finally
CloseFile(namrunner);
//End;

try
Proc := TProcessEx.Create(nil);
Proc.Executable := 'NAM-Runner060.bat';
Proc.OnErrorM:=@(ProcessError);
Proc.OnOutputM:=@(ProcessOutput);
Proc.Execute();
finally
Proc.Free;
end;
DeleteFile('NAM-Runner060.bat');
end;


procedure TMainForm.ProcessError(Sender: TProcessEx; IsException: boolean);
begin
MemConsole.Lines.Append('Erreur ! ' + Sender.ExceptionInfo);
end;

procedure TMainForm.ProcessOutput(Sender: TProcessEx; output : String);
begin
MemConsole.Lines.Text := MemConsole.Lines.Text + output;
// si vous avez des problème d'accent
//MemConsole.Lines.Text := MemConsole.Lines.Text + ConsoleToUtf8(output);
// pour scroll automatique
MemConsole.SelStart := Length(MemConsole.Lines.Text)-1;
MemConsole.SelLength:=0;
Application.ProcessMessages;
end;

end.

Binary file added neuralampcentral.ico
Binary file not shown.
125 changes: 125 additions & 0 deletions neuralampcentral.lpi
Original file line number Diff line number Diff line change
@@ -0,0 +1,125 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="Neural Amp Central"/>
<Scaled Value="True"/>
<ResourceType Value="res"/>
<UseXPManifest Value="True"/>
<XPManifest>
<DpiAware Value="True"/>
<LongPathAware Value="True"/>
<TextName Value="photophobic martin"/>
<TextDesc Value=""/>
</XPManifest>
<Icon Value="0"/>
</General>
<VersionInfo>
<UseVersionInfo Value="True"/>
<AutoIncrementBuild Value="True"/>
<MinorVersionNr Value="1"/>
<RevisionNr Value="1"/>
<BuildNr Value="42"/>
<Attributes pvaPreRelease="True" pvaPrivateBuild="True"/>
<StringTable CompanyName="photophobic martin" FileDescription="Installs and runs NAM trainer" InternalName="Neural Amp Central"/>
</VersionInfo>
<BuildModes>
<Item Name="Default" Default="True"/>
</BuildModes>
<PublishOptions>
<Version Value="2"/>
<OpenInFileMan Value="True"/>
<UseFileFilters Value="True"/>
</PublishOptions>
<RunParams>
<FormatVersion Value="2"/>
</RunParams>
<RequiredPackages>
<Item>
<PackageName Value="bgracontrols"/>
</Item>
<Item>
<PackageName Value="RunTimeTypeInfoControls"/>
</Item>
<Item>
<PackageName Value="LainzControls"/>
</Item>
<Item>
<PackageName Value="FCL"/>
</Item>
<Item>
<PackageName Value="richmemopackage"/>
</Item>
<Item>
<PackageName Value="python4lazarus_package"/>
</Item>
<Item>
<PackageName Value="rxnew"/>
</Item>
<Item>
<PackageName Value="atflatcontrols_package"/>
</Item>
<Item>
<PackageName Value="LCL"/>
</Item>
</RequiredPackages>
<Units>
<Unit>
<Filename Value="neuralampcentral.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="neural.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="MainForm"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
</Unit>
<Unit>
<Filename Value="nachelper.pas"/>
<IsPartOfProject Value="True"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="neuralampcentral"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<CodeGeneration>
<SmallerCode Value="True"/>
</CodeGeneration>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf2Set"/>
</Debugging>
<LinkSmart Value="True"/>
<Options>
<Win32>
<GraphicApplication Value="True"/>
</Win32>
</Options>
</Linking>
</CompilerOptions>
<Debugging>
<Exceptions>
<Item>
<Name Value="EAbort"/>
</Item>
<Item>
<Name Value="ECodetoolError"/>
</Item>
<Item>
<Name Value="EFOpenError"/>
</Item>
</Exceptions>
</Debugging>
</CONFIG>
26 changes: 26 additions & 0 deletions neuralampcentral.lpr
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
program neuralampcentral;

{$mode objfpc}{$H+}

uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, runtimetypeinfocontrols, neural
{ you can add units after this };

{$R *.res}

begin
RequireDerivedFormResource:=True;
Application.Title:='Neural Amp Central';
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TMainForm, MainForm);
Application.Run;
end.

Loading

0 comments on commit bbd9ed4

Please sign in to comment.